#pragma once
#include <iostream>
#include <functional>
void log()
{
    std::cout << "日志任务" << std::endl;
}
void download()
{
    std::cout << "下载任务" << std::endl;
}
void upload()
{
    std::cout << "上传任务" << std::endl;
}
class task
{
public:
    task()
    {
        _vt.push_back(log);
        _vt.push_back(download);
        _vt.push_back(upload);
    }
    void _execute(int code)
    {
        if (code >= 0 && code < _vt.size())
            _vt[code]();
    }

private:
    std::vector<std::function<void(void)>> _vt; // 任务
};